#!/usr/bin/env bash

# Enable idiomatic version files for java
mise settings set idiomatic_version_file_enable_tools java

cat <<EOF >.sdkmanrc
java=17.0.2
EOF
mise i java
assert_contains "mise x java -- java -version 2>&1" 'openjdk version "17.0.2"'
rm .sdkmanrc

cat <<EOF >.java-version
17.0.2
EOF
assert_contains "mise x java -- java -version 2>&1" 'openjdk version "17.0.2"'
rm .java-version

# Test installing EA version of Java 26
mise i "java[release_type=ea]@openjdk-26.0.0-ea"
assert_contains "mise x java@openjdk-26.0.0-ea -- java -version 2>&1" 'openjdk version "26-ea"'
